<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Auth;


/**
 * App\Models\Address
 *
 * @property int $address_id
 * @property int $shop_id
 * @property string|null $name
 * @property string|null $phone
 * @property string|null $province
 * @property string|null $city
 * @property string|null $district
 * @property string|null $street
 * @property string|null $postalcode
 * @property-read \App\Models\Shop $shop
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress whereAddressId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress whereCity($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress whereDistrict($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress wherePhone($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress wherePostalcode($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress whereProvince($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress whereShopId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\RefundAddress whereStreet($value)
 * @mixin \Eloquent
 */
class RefundAddress extends Model
{
    protected $table = 'refund_address';
    protected $primaryKey = 'address_id';
    protected $fillable = [
        'shop_id', 'name', 'phone', 'province', 'city', 'district', 'street', 'postalcode'
    ];

    public $timestamps = false;

    public static function boot()
    {
        parent::boot(); // TODO: Change the autogenerated stub
        static::creating(function (Address $address) {
            $address->uid = Auth::id();
        });
    }

    /**
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function shop()
    {
        return $this->belongsTo(Shop::class, 'shop_id', 'shop_id');
    }
}
